Even though the ORDER BY
clause supports using column numbers, doing so makes the code difficult to read and maintain. Therefore the
use of column names is preferred.
Noncompliant code example
BEGIN
SELECT col2, col3
BULK COLLECT INTO result
FROM my_table
ORDER BY
1 ASC; -- Noncompliant - if col1 is added to the selected fields, this may break
END;
/
Compliant solution
BEGIN
SELECT col2, col3
BULK COLLECT INTO result
FROM my_table
ORDER BY
col2 ASC;
END;
/